home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / c / vfork.man < prev    next >
Encoding:
Text File  |  1989-02-23  |  2.4 KB  |  67 lines

  1.  
  2.  
  3.  
  4. VFORK                 C Library Procedures                  VFORK
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      vfork - spawn new process in a virtual memory efficient way
  10.  
  11. SSYYNNOOPPSSIISS
  12.      ppiidd == vvffoorrkk(())
  13.      iinntt ppiidd;;
  14.  
  15. DDEESSCCRRIIPPTTIIOONN
  16.      _V_f_o_r_k can be used to create new processes without fully
  17.      copying the address space of the old process, which is
  18.      horrendously inefficient in a paged environment.  It is use-
  19.      ful when the purpose of _f_o_r_k(2) would have been to create a
  20.      new system context for an _e_x_e_c_v_e.  _V_f_o_r_k differs from _f_o_r_k
  21.      in that the child borrows the parent's memory and thread of
  22.      control until a call to _e_x_e_c_v_e(2) or an exit (either by a
  23.      call to _e_x_i_t(2) or abnormally.) The parent process is
  24.      suspended while the child is using its resources.
  25.  
  26.      _V_f_o_r_k returns 0 in the child's context and (later) the pid
  27.      of the child in the parent's context.
  28.  
  29.      _V_f_o_r_k can normally be used just like _f_o_r_k. It does not work,
  30.      however, to return while running in the childs context from
  31.      the procedure that called _v_f_o_r_k since the eventual return
  32.      from _v_f_o_r_k would then return to a no longer existent stack
  33.      frame.  Be careful, also, to call __e_x_i_t rather than _e_x_i_t if
  34.      you can't _e_x_e_c_v_e, since _e_x_i_t will flush and close standard
  35.      I/O channels, and thereby mess up the parent processes stan-
  36.      dard I/O data structures.  (Even with _f_o_r_k it is wrong to
  37.      call _e_x_i_t since buffered data would then be flushed twice.)
  38.  
  39. SSEEEE AALLSSOO
  40.      fork(2), execve(2), sigvec(2), wait(2),
  41.  
  42. DDIIAAGGNNOOSSTTIICCSS
  43.      Same as for _f_o_r_k.
  44.  
  45. BBUUGGSS
  46.      This system call will be eliminated when proper system shar-
  47.      ing mechanisms are implemented. Users should not depend on
  48.      the memory sharing semantics of _v_f_o_r_k as it will, in that
  49.      case, be made synonymous to _f_o_r_k.
  50.  
  51.      To avoid a possible deadlock situation, processes that are
  52.      children in the middle of a _v_f_o_r_k are never sent SIGTTOU or
  53.      SIGTTIN signals; rather, output or _i_o_c_t_ls are allowed and
  54.      input attempts result in an end-of-file indication.
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63. Sprite v1.0               June 30, 1985                         1
  64.  
  65.  
  66.  
  67.